import uvicorn
from starlette.staticfiles import StaticFiles

from fastapi import FastAPI
from web.fastapi_file import fileRoute
from web.fastapi_form import formRoute
from web.fastapi_jinja2 import jinja2Router
from web.fastapi_json import jsonRouter

app = FastAPI()

# 设置静态文件目录
app.mount("/statics", StaticFiles(directory="./static/statics"), name="statics")
app.include_router(jsonRouter,prefix="/json",tags=["处理JSON类型示例"])
app.include_router(formRoute,prefix="/form",tags=["处理FORM表单类型示例"])
app.include_router(fileRoute,prefix="/file",tags=["处理FILE表单类型示例"])
app.include_router(jinja2Router,prefix="/jinja2",tags=["文件模板jinja示例"])

if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port=8000)